package com.gouda.employee.api.controller;

import com.hephaestus.utils.GsonUtil;
import com.themis.dto.BackendSystemUserDto;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import javax.servlet.http.HttpServletRequest;
import java.util.Map;

/**
 * Created by KGL on 2015/12/5.
 */
@Controller
@RequestMapping(value = "/test")
public class TestController extends AbstractController {

    @ResponseBody
    @RequestMapping(value = "/test.json")
    public String test(final HttpServletRequest request) {
        final Map<String, String> params = super.getBodyAsMap(request);
        final String propertyId = params.get("receiveId");

        BackendSystemUserDto dto = new BackendSystemUserDto();
        dto.setUserId(110l);
        dto.setUserCode(propertyId);
        dto.setUserName("name");
        dto.setUserType(2);

        return GsonUtil.transObj2Json(dto);
    }
}
